﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WcfServer.Classes.Utility;

namespace WcfServer.Classes.Server
{
    [Serializable]
    public class LoginResponse
    {
        public List<UserSimple> Friends { set; get; }
        public byte[] Sign { set; get; } // encrypted using server private key.
        public LoginResponse()
        {

        }
        public LoginResponse(byte[] data, byte[] key)
        {
            byte[] temp = Utility.EncryptionHandler.DecryptAES(data, key);
            var lr = SerializerHandler<LoginResponse>.DeSerializeInput(temp);
            this.Sign = lr.Sign;
            this.Friends = lr.Friends;
        }
        public byte[] Send(byte[] key)
        {
            var lr = SerializerHandler<LoginResponse>.SerializeInput(this);
            return EncryptionHandler.EncryptAES(lr, key);
        }
    }
}
